import React, { Component } from 'react'
import {Switch, Route, Redirect} from 'react-router-dom'
// 路由懒加载
import Loadable from 'react-loadable';
// 路由懒加载-加载过程中显示的组件
import Loading from './compontents/Loading';

// import Blog from './compontents/Blog'
// import ComFather from './compontents/ComFather'
// import ComA from './compontents/ComA'
// import ComC from './compontents/ComC'

const Blog = Loadable({
  loader: () => import('./compontents/Blog'),
  loading: Loading,
});
const ComFather = Loadable({
  loader: () => import('./compontents/ComFather'),
  loading: Loading,
});
const ComA = Loadable({
  loader: () => import('./compontents/ComA'),
  loading: Loading,
});
const ComC = Loadable({
  loader: () => import('./compontents/ComC'),
  loading: Loading,
});
const Big = Loadable({
  loader: () => import('./compontents/Big'),
  loading: Loading,
});
const GoodsList = Loadable({
  loader: () => import('./compontents/GoodsList'),
  loading: Loading,
});
const GoodsDetail = Loadable({
  loader: () => import('./compontents/GoodsDetail'),
  loading: Loading,
});
const AntTable = Loadable({
  loader: () => import('./compontents/AntTable'),
  loading: Loading,
});
const AntForm = Loadable({
  loader: () => import('./compontents/AntForm'),
  loading: Loading,
});

export default class Router extends Component {
  render() {
    return (
      <Switch>
        {/* exact 严格匹配 */}
        <Route path="/index" exact component={ComC} />
        <Redirect path="/index" to='/Blog'></Redirect>
        <Route path="/Blog" component={Blog} />
        <Route path="/ComFather" component={ComFather} />
        <Route path="/ComA" component={ComA} />
        <Route path="/big" component={Big} />
        <Route path="/table" component={AntTable} />
        <Route path="/form" component={AntForm} />
        <Route path="/goodslist" component={GoodsList} />
        <Route path="/GoodsDetail/:name" component={GoodsDetail} />
      </Switch>
    )
  }
}
